package com.itheima.reggie.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.reggie.entity.Setmeal;
import com.itheima.reggie.mapper.SetMealMapper;
import com.itheima.reggie.service.SetMealService;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class SetMealServiceImpl implements SetMealService {

    @Autowired
    private SetMealMapper mapper;

    /*根据分类id来查询套餐表，查询这个分类在套餐表里面的总数*/
    @Override
    public int findCountByCategoryId(long categoryId) {

        //执行查询条件
        LambdaQueryWrapper<Setmeal> qw = new LambdaQueryWrapper<>();
        qw.eq(Setmeal::getCategoryId,categoryId);



        return mapper.selectCount(qw);
    }
}
